import type { EChartsOption } from 'echarts'
import * as echarts from 'echarts/core'

export function getOption(): EChartsOption {
  let color = ['#0E7CE2', '#FF8352', '#E271DE', '#F8456B', '#00FFFF', '#4AEAB0'];
  let echartData:any = [
    {
      name: '已处理',
      value: '3720',
    },
    {
      name: '待处理',
      value: '2920',
    },
    {
      name: '未处理',
      value: '2200',
    },
  ];
  return {
    color: color,
    title: [
      {
        text: '已处理',
        left: 'center',
        top: '35%',
        textStyle: {
          color: '#fff',
          fontSize: 15,
          fontWeight: 700,
        },
      },
      {
        text: '5个',
        left: 'center',
        top: '50%',
        textStyle: {
          fontSize: 16,
          color: '#fff',
          fontWeight: 500,
        },
      },
    ],
    polar: {
      radius: ['44%', '50%'],
      center: ['50%', '50%'],
    },
    angleAxis: {
      max: 100,
      show: false,
    },
    radiusAxis: {
      type: 'category',
      show: true,
      axisLabel: {
        show: false,
      },
      axisLine: {
        show: false,
      },
      axisTick: {
        show: false,
      },
    },
    /*图例组件来源data里面的name*/
    legend: {
      textStyle: {
        color:'#ededed',
      },
      lineStyle:{
        color:"#cdcdcd"
      },
      show: true,
      icon: 'circle',
      right: '3%',
      left: '1%',
      bottom:0,
      itemWidth: 10, //每个宽
      itemStyle: {
        borderColor: 'none',
      },
    },
    series: [
      {
        type: 'pie',
        radius: ['55%', '67%'],
        center: ['50%', '50%'],
        data: echartData,
        labelLine: {
          show:false
        },
        label: {
          show: false, //开启显示
        },
      },
      {
        name: '',
        type: 'pie',
        startAngle: 90,
        radius: '50%',
        center: ['50%', '50%'],
        labelLine:{
          show:false,
        },
        itemStyle: {
          color: new echarts.graphic.RadialGradient(0.5, 0.5, 1, [
            {
              offset: 1,
              color: 'rgba(50,171,241, 1)',
            },
            {
              offset: 0,
              color: 'rgba(55,70,130, 0)',
            },
          ]),
          borderWidth: 1,
          shadowBlur: 10,
          shadowColor: 'rgba(55,70,130, 1)'
        },
        data: [
          {
            value: 100,
          },
        ],
      },
    ],
  };
}
